import java.io.*;
import java.net.URI;
import java.awt.* ;
public class TestMember
{
	static FileWriter fout = null;
	public static void main (String args[])
	{
		try
		{
			fout = new FileWriter("Member.html");
			Member m = null;
			fout.write("<HTML><HEAD><title>Member list</title></HEAD><left><TABLE>");
			for(int i=0;i<20;i++)
			{
				m = getMember();
				fout.write(m.toTableRow());
			}
			fout.write("</TABLE></left></HTML>");
			fout.close();
			launchBrowser("Member.html");
		}
		catch(IOException e)
		{
			e.printStackTrace();
		}
	}
	static void launchBrowser(String fileName)
	{
		try
		{
			File file = new File(fileName);
			URI uri = file.toURI();
			Desktop.getDesktop().browse(uri);
		}
		catch(IOException e)
		{
			e.printStackTrace();
		}
	}
	static Member getMember()
	{
		int k = Member.rdm.nextInt(5);
		switch(k)
		{
		case 0: return new Member();
		case 1: return new Student();
		case 2: return new Staff();
		case 3: return new Ficuty();
		case 4: return new Employee();
		}
		return null;
	}
}